/*******************************************************************************
 * Copyright (c) 2009 Brian Edginton and Aaron Getz.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Brian Edginton - initial API and implementation
 *     Aaron Getz
 *******************************************************************************/

package org.eclipse.mylyn.internal.eplanner.ui.tasklist;

import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.mylyn.internal.eplanner.core.EPlannerCorePlugin;
import org.eclipse.mylyn.internal.eplanner.ui.wizard.EPlannerRepositorySettingsPage;
import org.eclipse.mylyn.internal.eplanner.ui.wizard.NewEplannerTaskWizard;
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
import org.eclipse.mylyn.tasks.core.ITaskMapping;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
import org.eclipse.mylyn.tasks.ui.wizards.ITaskRepositoryPage;
import org.eclipse.mylyn.tasks.ui.wizards.ITaskSearchPage;
import org.eclipse.mylyn.tasks.ui.wizards.RepositoryQueryWizard;

public class EPlannerConnectorUI extends AbstractRepositoryConnectorUi {

	@SuppressWarnings("restriction")
	@Override
	public String getConnectorKind() {
		return EPlannerCorePlugin.CONNECTOR_KIND;
	}

	@Override
	public ITaskRepositoryPage getSettingsPage(TaskRepository taskRepository) {
		return new EPlannerRepositorySettingsPage(taskRepository);
	}
	
	public ITaskSearchPage getSearchPage(TaskRepository taskRepository, IStructuredSelection selection) {
		return new EPlannerCustomQueryWizardPage("test1", taskRepository);
	}

	@Override
	public boolean hasSearchPage() {
		return true;
	}

	@Override
	public IWizard getNewTaskWizard(TaskRepository taskRepository, ITaskMapping selection) {
		return new NewEplannerTaskWizard();
	}

	@Override
	public IWizard getQueryWizard(TaskRepository taskRepository, IRepositoryQuery query) {
		RepositoryQueryWizard wizard = new RepositoryQueryWizard(taskRepository);
		wizard.addPage(new EPlannerCustomQueryWizardPage("test", taskRepository, query));
		return wizard;
	}
}
